package com.itheima05;

public class Foodie extends Thread{
    @Override
    public void run() {
        while (true){
            synchronized (Desk.lock){
                if(Desk.count==0){
                    break;
                }
                if(Desk.falg){
                    System.out.println("吃货吃一个汉堡");
                    Desk.falg=false;
                    Desk.count--;
                    Desk.lock.notifyAll();
                }else{
                    try {
                        Desk.lock.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
}
